<?

/**
* Use $_SESSION["GDate"] if you are using custom date
* or just use the system date
*
* $today_date = $_SESSION["GDate"];
* $today_date = date("d-m-Y");
*
*/
$today_date		  = date("d-m-Y");

$thisSequence   = "C_B_SEQ";
$jobIdTag       = "14";

$srcDbHdr      = "MST_CASH_BANK";
$srcDbDtl      = "MST_CASH_BANK_USR";
$srcDbHdrLog   = "LOG_MST_CASH_BANK";
$srcDbSequence = "MST_SEQUENCE";

$UID     = unserialize($_SESSION["serUID"]);

$userId  = $UID->getUID();

$Db = new oracleDb;
$Db->init($_SESSION["ORCL"],
           $_SESSION["OPASS"],
           $_SESSION["SID"],
           _NO_COMMENT);

if($Db->connect()){

  $hdrDate = "TO_DATE('".$_POST["trDateEnt"]."' , 'dd-mm-YYYY')";

  for($iRow = 0; $iRow < $dataup ; $iRow++){

    $values = " '".$_POST["codeEnt"]."', ".
              "  ".($iRow+1)." , ".
              " '".$_POST["userEnt"][$iRow]."' ";

    $CLHandlers->insToCbUser($Db,
                             $values,
                             $SourceDb->fetchValue("srcDbDtl"));
  }

  $values = " '".$_POST["codeEnt"]."',     ".
            " '".$_POST["nameEnt"]."',     ".
            " '".$_POST["accNoEnt"]."',    ".
            " '".$_POST["typeEnt"]."',     ".
            " '".$_POST["currencyEnt"]."', ".
            " '".$_POST["glAccEnt"]."',    ".
            " '".$_POST["glSubAccEnt"]."'  ";

  $CLHandlers->insToMstCb($Db,
                          $values,
                          $SourceDb->fetchValue("srcDbHdr"));

	$Db->commit();

	if($Db->getStatus()){

	  $Misc->usrMsg("Upload Complete");
	}else{

	  $Misc->usrDieJs("Upload Process Interupted");
	}

	$Db->dc();

	/**
	* Pending...
	* I'm not sure if this
	* reset procedure off
	* causes buggy
	*
	*	$restore  = 0;
	* $uprun    = 0;
	* $dataup   = 0;
	*
	*/

	//jumpTo(2,"../".$_SESSION["source_caller"]);

}else{

	$Misc->usrDieJs("Db connection failed");
}

?>